<div class="block" id="block-login">
    <div class="wrap">
        <h3>
            <?php if($this->user):?>
                <?php echo $this->user->name?> 
            <?php else:?>
                Đăng nhập
            <?php endif?>    
            <span class="underline"></span>
        </h3>
        <div class="box">

            <?php if($this->user):?>

                <ul class="nav nav-list">
                    <li><a href="<?php echo $this->createUrl('/user/page/update')?>">Cập nhật tài khoản</a></li>
                    <li><a href="<?php echo $this->createUrl('/user/page/managePhone')?>">Quản lý SĐT</a></li>
                    <li><a href="<?php echo $this->createUrl('/user/page/manageEmail')?>">Quản lý Email & Openid</a></li>
                    <li><a href="<?php echo $this->createUrl('/user/page/password')?>"><?php echo $this->user->password ? 'Đổi mật khẩu' : 'Tạo mật khẩu'?></a></li>
                    
                    <?php if(!empty($this->userInfo) && $this->userInfo->isMod):?>
                    
                            <li class="divider"></li>
                            <li><a href="<?php echo $this->createUrl('/hehe/web/image/index', array('type' => 'review'))?>">Duyệt ảnh</a></li>
                            <li><a href="<?php echo $this->createUrl('/hehe/web/video/index', array('type' => 'review'))?>">Duyệt video</a></li>
                            <li><a href="<?php echo $this->createUrl('/hehe/web/joke/index', array('type' => 'review'))?>">Duyệt truyện</a></li>
                            <li><a href="<?php echo $this->createUrl('/hehe/web/crawl/jokeVnexpress')?>">Crawl Vnexpress's Jokes</a></li>
                    
                    <?php endif;?>
                    
                    <li><a href="<?php echo $this->createUrl('/user/page/logout')?>">Thoát</a></li>
                </ul>

                <?php else:?>
 
                <div>

                        <?php echo CHtml::beginForm(Yii::app()->createAbsoluteUrl('/user/page/login'), 'post', array(
                                'id'=>'login-form-block',
                                'class' => 'form-horizontal my-form'   
                            )); ?>

                        <div class="margintop5">
                            <?php echo CHtml::textField('LoginForm[username]', null, array('placeholder'=> 'Email/Số ĐT','maxlength'=>255, 'class' => 'input-small'));?>
                        </div> 

                        <div class="margintop5">
                            <?php echo CHtml::passwordField('LoginForm[password]', null, array('placeholder'=> 'Mật khẩu','maxlength'=>255, 'class' => 'input-small'));?>
                        </div>

                        <div class="margintop5 clearfix">
                            <div class="col-lg-6 pull-left">
                                <button type="submit" class="btn btn-primary btn-small">
                                    <i class="icon-signin"></i> Đăng nhập
                                </button>
                            </div>    
                            <div class="col-lg-6 my-openid pull-right">

                                <a href="<?php echo $this->createUrl('/user/page/login', array('service' => 'facebook'))?>" class="openid_popup decoration-none" rel="tooltip" data-placement="top" title="Đăng nhập bằng tài khoản Facebook">
                                    <i class="icon-facebook-sign icon-2x"></i>
                                </a>
                                &nbsp;
                                <a href="<?php echo $this->createUrl('/user/page/login', array('service' => 'google'))?>" class="openid_popup decoration-none" rel="tooltip" data-placement="top" title="Đăng nhập bằng tài khoản Google" >
                                    <i class="icon-google-plus-sign icon-2x"></i>
                                </a>
                            </div> 
                        </div>
                        <?php echo CHtml::endForm(); ?>

                        <hr/>

                        <div class="pull-right">
                            <ul class="my-link col-lg-12">
                                <li><a class="decoration-none" href="<?php echo $this->createUrl('/user/page/create')?>"><span class="label label-success">Đăng ký</span></a></li>
                                <li><a class="decoration-none" href="<?php echo $this->createUrl('/user/page/forgot')?>"><span class="label label-warning">Quên mật khẩu</span></a></li>
                            </ul>
                        </div>

                </div>
                <?php endif?> 


        </div>
    </div>
</div>